package org.agent.interceptor;



import org.agent.common.Constants;
import org.agent.pojo.User;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AdminInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
					//获取session的登入对象信息在判断
		User sessionUser = (User) invocation.getInvocationContext().getSession()
					.get(Constants.SESSION_USER);
		if(null!=sessionUser&&null!=sessionUser.getUserCode()&&null!=sessionUser.getUserPassword()
				&&sessionUser.getIsStart()==1){
			return invocation.invoke();//继续执行action
			
		}else {
			return Action.LOGIN;
		}
	}

}
